package com.sanadc.shohdi.chapter2.override_object_method;





public class MailMessageProgram
{
	public static void main(String[] args)
	{
		//Create a new instance of MailMessage
		MailMessage original = new MailMessage("bsbill","jsmith","This is the original text");
		
		
		MailMessage shallowCopy = new MailMessage("a", "b","c");
		//Create a shallow copy
		try
		{
			shallowCopy = (MailMessage)(original.clone());
		}
		catch (CloneNotSupportedException ex)
		{
			
		}
		 
		
		
		StringBuffer text = shallowCopy.getMessageText();
		
		//Modify the message text using the clone/shallow copy
		text.append(" with some additional text appended");
		
		//Now print out the message text using the original MailMessage
		System.out.println(original.getMessageText().toString());
		
		
		
	}
	
	
	
}